package com.leoman.plz_p.adapter;

import android.content.Context;
import android.graphics.Color;

import com.leoman.plz_p.R;
import com.leoman.plz_p.module.bean.ExamRecordBean;

import cn.com.corelib.utils.adapter.BaseAdapterHelper;
import cn.com.corelib.utils.adapter.normal.QuickAdapter;

/**
 * Created by guoh on 2018/7/3.
 */
public class ExamRecordAdapter extends QuickAdapter<ExamRecordBean> {
    public ExamRecordAdapter(Context context) {
        super(context, R.layout.item_exam_record);
    }

    @Override
    protected void convert(BaseAdapterHelper helper, ExamRecordBean item, int position) {
        boolean isPass=item.getPass()==1;
        helper.setText(R.id.tv_grade,item.getSource()+"分")
                .setText(R.id.tv_time,item.getTitle())
                .setText(R.id.tv_grade_2,isPass?"合格":"不合格")
                .setText(R.id.tv_date,item.getCreatetime())
                .setTextColor(R.id.tv_grade,isPass?Color.parseColor("#59b5f9"): Color.parseColor("#ff0000"))
                .setTextColor(R.id.tv_grade_2,isPass?Color.parseColor("#59b5f9"): Color.parseColor("#ff0000"));
    }
}
